package com.mycompany.myapp.example;

import java.math.*;
import java.util.Date;
import java.util.List;
import com.mycompany.myapp.dao.MonstreDao;
import com.mycompany.myapp.dto.Monstre;
import com.mycompany.myapp.exceptions.MonstreDaoException;
import com.mycompany.myapp.factory.DaoFactory;

public class MonstreDaoExample
{
	/**
	 * Method 'main'
	 * 
	 * @param arg
	 * @throws Exception
	 */
	public static void main(String[] arg) throws Exception
	{
		// Uncomment one of the lines below to test the generated code
		
		// findAll();
		// findWhereIdMonstreEquals(0);
		// findWhereVieActuelleMEquals(0);
		// findWhereVieMaxMEquals(0);
		// findWhereLieuActuelMEquals(0);
	}

	/**
	 * Method 'findAll'
	 * 
	 * @throws Exception
	 */
	public static void findAll() throws Exception
	{
		MonstreDao dao = DaoFactory.createMonstreDao();
		List<Monstre> _result = dao.findAll();
		for (Monstre dto : _result) {
			display(dto);
		}
		
	}

	/**
	 * Method 'findWhereIdMonstreEquals'
	 * 
	 * @param idMonstre
	 * @throws Exception
	 */
	public static void findWhereIdMonstreEquals(int idMonstre) throws Exception
	{
		MonstreDao dao = DaoFactory.createMonstreDao();
		List<Monstre> _result = dao.findWhereIdMonstreEquals(idMonstre);
		for (Monstre dto : _result) {
			display(dto);
		}
		
	}

	/**
	 * Method 'findWhereVieActuelleMEquals'
	 * 
	 * @param vieActuelleM
	 * @throws Exception
	 */
	public static void findWhereVieActuelleMEquals(int vieActuelleM) throws Exception
	{
		MonstreDao dao = DaoFactory.createMonstreDao();
		List<Monstre> _result = dao.findWhereVieActuelleMEquals(vieActuelleM);
		for (Monstre dto : _result) {
			display(dto);
		}
		
	}

	/**
	 * Method 'findWhereVieMaxMEquals'
	 * 
	 * @param vieMaxM
	 * @throws Exception
	 */
	public static void findWhereVieMaxMEquals(int vieMaxM) throws Exception
	{
		MonstreDao dao = DaoFactory.createMonstreDao();
		List<Monstre> _result = dao.findWhereVieMaxMEquals(vieMaxM);
		for (Monstre dto : _result) {
			display(dto);
		}
		
	}

	/**
	 * Method 'findWhereLieuActuelMEquals'
	 * 
	 * @param lieuActuelM
	 * @throws Exception
	 */
	public static void findWhereLieuActuelMEquals(int lieuActuelM) throws Exception
	{
		MonstreDao dao = DaoFactory.createMonstreDao();
		List<Monstre> _result = dao.findWhereLieuActuelMEquals(lieuActuelM);
		for (Monstre dto : _result) {
			display(dto);
		}
		
	}

	/**
	 * Method 'display'
	 * 
	 * @param dto
	 */
	public static void display(Monstre dto)
	{
		StringBuffer buf = new StringBuffer();
		buf.append( dto.getIdMonstre() );
		buf.append( ", " );
		buf.append( dto.getVieActuelleM() );
		buf.append( ", " );
		buf.append( dto.getVieMaxM() );
		buf.append( ", " );
		buf.append( dto.getLieuActuelM() );
		System.out.println( buf.toString() );
	}

}
